Force feedback (Teslaglove)

Teslasuit v. Teslasuit SDK Python

Quick access

Intro

The Magnetic Encoder subsystem provides functions to control servomotors for haptic feedback and movement restriction.

Note:

since TsMagneticEncoder is a member of the device class and cannot be used independently without an active Teslasuit device.

Class TsMagneticEncoder

Handles servomotor magnetic encoder control, including locking directions and configuring feedback parameters.

Class methods:


get_positions(self)

Get the current positions of the fingers.

Returns:

  • dict: A dictionary of bone indexes and their corresponding TsFingerMEPosition.

start_me_streaming(self)

Starts magnetic encoder data streaming. This method subscribes to the data update callback and starts streaming.


stop_me_streaming(self)

Stops magnetic encoder data streaming. This method stops the streaming and unsubscribes from the data update callback.


ts_magnetic_encoder_enable(self, me_configs)

Enable magnetic encoder for the specified bone indexes.

Args:


ts_magnetic_encoder_disable(self, bone_indexes)

Disable magnetic encoder for the specified bone indexes.

Args:

  • bone_indexes (list): A list of bone indexes to disable magnetic encoder for.

get_default_me_controls_struct(self)

Get the default magnetic encoder controls structure.

Returns:


get_default_ff_controls_struct(self)

Get the default force feedback controls structure for the magnetic encoder.

Returns:


get_bone_indexes(self)

Get the bone indexes for the magnetic encoder.

Returns:

  • list: A list of bone indexes.

Utilities

Utility functions:


get_position_struct_for_bones(bone_indexes)

Create a dictionary of TsFingerMEPosition for the given bone indexes.

Args:

  • bone_indexes (list): List of bone indexes.

Returns:


get_left_default_position_struct()

Create a default position struct for the left hand.

Returns:


get_right_default_position_struct()

Create a default position struct for the right hand.

Returns:


mirror_bone_index(bone_index)

Mirror the bone index for the opposite hand.

Args:

  • bone_index: Bone index to be mirrored.

Returns:

  • int: Mirrored bone index.

get_me_controls_struct_for_bones(bone_indexes)

Create a TsForceFeedbackConfig structure for the given bone indexes.

Args:

  • bone_indexes (list): List of bone indexes.

Returns:


get_left_default_me_controls_struct()

Create a default magnetic encoder controls struct for the left hand.

Returns:


get_right_default_me_controls_struct()

Create a default magnetic encoder controls struct for the right hand.

Returns:

Access to the data

These code snippets and charts are just an example of how is the data flow looks like. to know more, please visit data structures page.

Access to finger positions

TsMagneticEncoder.get_positions().fingers[TsBone2dIndex.LeftThumbProximal].flexion_angle

flowchart TD
A[TsFingerMEPosition] --> B[flexion_angle]
A --> C[abduction_angle]

Access to force feedback configuration

TsMagneticEncoder.get_default_ff_controls_struct().bone_index

flowchart TD
A[TsForceFeedbackConfig] --> B[bone_index]
A --> C[angle]
A --> D[hardness_percent]
A --> E[lock_direction]